home *** CD-ROM | disk | FTP | other *** search
/ CD Classic 39 / CD CLASSIC #39 (1998).iso / EMPRESA / visio / Vistdstd / Install / Data.Z / Viscntrl.TXT < prev    next >
Text File  |  1997-07-28  |  13KB  |  194 lines

  1. ***************************************************************
  2.   VISCNTL.TXT
  3.   Copyright (c) 1997 Visio Corporation. All rights reserved.
  4. ***************************************************************
  5. To view this file in Notepad, choose Word Wrap from the Edit menu. To print it neatly from Notepad, adjust the width of the Notepad window such that the window is about the same width as the first line of asterisks.
  6.  
  7. This file provides information about using Visio as an ActiveX control in a custom Visio solution. It assumes that you have a basic understanding of COM and ActiveX. It also assumes that you are familiar with Automation in Visio and have a working knowledge of C++ or Microsoft Visual Basic.  
  8.  
  9. For information about creating Visio solutions that use Automation, see the Developing Visio Solutions manual. It contains details about the Visio object model and about using Visual Basic or C++ to control Visio.
  10.  
  11. For the latest information about developing Visio solutions, or for assistance in developing your solution from the Visio Consulting Group, visit the Visio Web site at http://www.Visio.com or contact Visio Customer Service at 1-800-24-VISIO.
  12.  
  13.  
  14. Introduction
  15. ============
  16. ActiveX technology is a relatively new and rapidly growing way to create solutions. In Visio 5.0, the Visio ActiveX control is preliminary and is intended for experienced solution providers who want a head start in creating solutions using ActiveX. We hope you will give it a try, and we encourage you to contact us with questions, comments, and suggestions so we can continue to improve this feature.
  17.  
  18. We recommend you use the Visio ActiveX control in solutions created with Visual Basic 4.0 or higher or with C++ (native C++ or MFC). Using the Visio ActiveX control in control containers such as Microsoft Word 97 or Microsoft Excel 97 is not guaranteed.
  19.  
  20.  
  21. Licensing the Visio ActiveX Control
  22. ===================================
  23. Visio does not provide a separate license for using Visio as an ActiveX control. This means that Visio 5.0 must be installed on a user's system in order to run a solution that contains a Visio ActiveX control. 
  24.  
  25. Visio Corporation does offer licensing of the Visio product, so if you create Visio solutions with widespread usage you can license Visio. For more information, contact Visio Customer Service.
  26.  
  27.  
  28. Registering the Visio ActiveX Control
  29. =====================================
  30. Before you can insert the Visio ActiveX control into a solution, you must register the Visio ActiveX object in the system registry. 
  31.  
  32. To register the Visio ActiveX control on your system, run regsvr32.exe from the folder that contains the Visio program files. If you accepted the defaults during installation, this folder is C:\Program Files\Visio. For example: 
  33.  
  34. REGSVR32 Vislib32.dll
  35.  
  36. To remove the Visio ActiveX control from the registry, run regsvr32.exe using the /UNREGISTER flag. For example:
  37.  
  38. REGSVR32 /UNREGISTER Vislib32.dll
  39.  
  40.  
  41. InProc Activation of the Visio ActiveX Control
  42. ==============================================
  43. When a Visio ActiveX control is inserted into a controlling application (also called the ActiveX document container) Visio is loaded in the same process space as the container. This is known as "InProc activation" and its behavior differs significantly from that of Visio objects, which are loaded out of process when inserted into a document. 
  44.  
  45. InProc activation improves the performance of your solution, especially during load time, because Visio is running in the same address space as the container. You will also notice that Visio.exe does not execute when a Visio ActiveX control is activated. 
  46.  
  47.  
  48. Visio ActiveX Ambient Properties
  49. ================================
  50. When a Visio ActiveX control is activated in an ActiveX container, the control queries the container for its ambient properties. These define the "ambient" environment provided by the container, allowing it to determine the behavior of the Visio ActiveX control with little or no programming, simply by setting the values of its ambient properties. 
  51.  
  52. A container can set ambient properties to change the background color of the Visio ActiveX control, enable resizing, display the control with a border, or determine whether the control is in run mode or design mode.
  53.  
  54. In Visio 5.0, the Visio ActiveX control supports the following ambient properties:
  55.  
  56. BackGroundColor (DISP_AMBIENT_BACKCOLOR)
  57. ----------------------------------------
  58. Determines the background color to use when drawing a Visio page. Set BackGroundColor to the same color as the background of the ActiveX container to create a transparent effect for the Visio ActiveX control.
  59.         
  60. ShowGrabHandles (DISP_AMBIENT_SHOWGRABHANDLES)
  61. ----------------------------------------------
  62. Determines whether the Visio ActiveX control displays selection handles, which allow the user to move and size the control. This property can be used to either show the handles as you typically would in design mode, or hide them in run mode. Set ShowGrabHandles to TRUE to display selection handles on the control. Set ShowGrabHandles to FALSE to hide selection handles, which prevents the user from moving or sizing the control. 
  63.  
  64. ShowHatching (DISP_AMBIENT_SHOWHATCHING)
  65. -----------------------------------------
  66. Determines whether the Visio ActiveX control displays a hatched border when the user activates the control. Set ShowHatching to TRUE to display the hatched border. Set ShowHatching to FALSE to hide the border.
  67.  
  68. UserMode (DISP_AMBIENT_USERMODE)
  69. ---------------------------------
  70. Indicates whether the Visio ActiveX control is activated in run mode or design mode. If UserMode is TRUE, the Visio ActiveX control is activated in run mode, which means it fires events. If UserMode is FALSE, the Visio ActiveX control is activated in design mode, which means it does not fire events. 
  71.  
  72.         
  73. Programming the Visio ActiveX Control
  74. =====================================
  75. You use the same Automation techniques described in Developing Visio Solutions to program a Visio ActiveX control, with these enhancements:
  76.  
  77. * The Visio object model has a new object, the Control object, which represents a drawing page in a Visio ActiveX control. The Control object has the same properties, methods, and events as a Page object, and can be used in the same way. For details, see the Page object and individual properties, methods, and events in Progref.hlp.
  78.  
  79. * The Window object supports zooming and scrolling in the drawing window of a Visio ActiveX control. In Visio 4.5 and earlier, zooming and scrolling in embedded Visio objects was handled by the container, and it was not possible to zoom or scroll in the embedded Visio object independently. Use Window.Zoom to control magnification of the window (zoom in and out). Use Window.ShowScrollBars to show or hide scroll bars so the user can scroll the window. For details about Window.Zoom, see Progref.hlp. ShowScrollBars is described later in this Readme file.
  80.  
  81. When you insert a Visio ActiveX object in your solution, you automatically get a reference (interface) to a Control object that represents the drawing page in that control. A Control object typically represents a foreground page, but it can represent a background page. 
  82.  
  83. A Visio ActiveX control typically contains a single drawing page, but it can contain multiple pages. You can access pages in such a control in the same way as in an instance of Visio, such as using the ActivePage property of the control's Application object to retrieve the active page. 
  84.  
  85. To get a Window object on that drawing page, get the Application property of the Control object, then get the ActiveWindow property of that Application object.
  86.  
  87. For more information about working with Page and Window objects, see Developing Visio Solutions.
  88.  
  89.  
  90. ShowScrollBars Property
  91. =======================
  92. Applies to:    Window
  93.  
  94. Summary:    Determines whether Visio shows scroll bars in 
  95.         the window.
  96.  
  97. Version:    VISIO 5.0
  98.  
  99. Syntax:        intRet = object.ShowScrollBars
  100.         object. ShowScrollBars = intExpression
  101.  
  102.  
  103. Element        Description
  104.  
  105. intRet        0 if scrollbar display is off; 
  106.         -1 if scrollbar display is on
  107.  
  108. object        The Window object that has or gets the setting
  109.  
  110. intExpression    visScrollBarNeither = 0, to turn off both 
  111.         scroll bars.
  112.  
  113.         visScrollBarHoriz = 1, to display the 
  114.         horizontal scroll bar.
  115.  
  116.         visScrollBarVert = 4, to display the vertical 
  117.         scroll bar.
  118.  
  119.         visScrollBarBoth = 5, to display both scroll 
  120.         bars.
  121.  
  122. Remarks:    Currently there is no analogous option in the 
  123.         Visio menus for toggling the scroll bars. 
  124.  
  125.  
  126. Inserting the Visio ActiveX Control in a Solution
  127. =================================================
  128.  
  129. Using a Visio ActiveX Control in Microsoft Visual Basic 5
  130. ---------------------------------------------------------
  131.  
  132. 1. Activate Visual Basic (VB) and create a project.
  133. 2. Choose the Project.Components menu command.
  134. 3. Scroll down, then check the Visio 5.0 Type Library item in the Components list box. You should now see the Visio icon in the VB Toolbox.
  135. 4. Select the Visio icon in the Toolbox.
  136. 5. Drag a rectangle region where you want to place the Visio ActiveX control in your VB form. This adds a Visio ActiveX control by the name of "Control1" to your VB form.
  137. 6. Select either the Run toolbar button or Run menu item to start your VB form.
  138. 7. Double-click the Visio ActiveX object to activate the Visio control.
  139.  
  140. The Visio ActiveX control is now active and ready to be driven programmatically. The following code shows how you would turn on scroll bars for the control.
  141.  
  142.     Dim appVisio As VisioCtl.Application ' Visio's instance
  143.     Dim winVisio As VisioCtl.Window      ' Visio's drawing window
  144.     
  145.     ' Retrieve the current instance of Visio
  146.     Set appVisio = Control1.Application
  147.     Set winVisio = appVisio.ActiveWindow
  148.     winVisio.ShowScrollBars = visScrollBarBoth
  149.     Form1.Refresh
  150.  
  151.  
  152. Using a Visio ActiveX Control in Microsoft Visual Basic 4
  153. ---------------------------------------------------------
  154.  
  155. 1. Activate Visual Basic (VB) and create a project.
  156. 2. Choose the Tools.Custom Controls menu command.
  157. 3. Scroll down, then check the Visio 5.0 Type Library item in Components list box. You should now see the Visio icon in the VB Toolbox.
  158. 4. Select the Visio icon in the Toolbox.
  159. 5. Drag a rectangle region where you want to place the Visio ActiveX control in your VB form. This adds a Visio ActiveX control by the name of "Control1" to your VB form.
  160. 6. Select either the Run toolbar button or Run menu item to start your VB form.
  161. 7. Double-click the Visio ActiveX object to activate the Visio control.
  162.  
  163. The Visio ActiveX control is now active and ready to be driven programmatically. The following code shows how you would turn on scroll bars for the control.
  164.  
  165.     Dim appVisio As VisioCtl.Application ' Visio's instance
  166.     Dim winVisio As VisioCtl.Window      ' Visio's drawing window
  167.     
  168.     ' Retrieve the current instance of Visio
  169.     Set appVisio = Control1.Application
  170.     Set winVisio = appVisio.ActiveWindow
  171.     winVisio.ShowScrollBars = visScrollBarBoth
  172.     Form1.Refresh
  173.  
  174.  
  175.  
  176. Known Limitations of the Visio ActiveX Control
  177. ==============================================
  178. In Visio 5.0, you cannot insert one Visio ActiveX control into another. This is a side effect of trying to InProc-activate Vislib32.dll inside itself, which currently does not work reliably. Until this is tested further, the Visio ActiveX control has been removed from the list of controls that can be inserted into Visio.
  179.  
  180. Only one Visio ActiveX control at a time can be visible and active in an ActiveX container. Again, this is a side effect of loading Vislib32.dll InProc. If your solution requires multiple Visio windows to be visible in a container application at the same time, base your solution on Visio embedded objects rather than Visio ActiveX controls. Supporting multiple active Visio ActiveX controls is planned for a future release.
  181.  
  182. Visual Basic for Applications (VBA) is not supported when Visio is activated as an ActiveX control. This should have little or no effect when you are developing your solutions, because you typically use the ActiveX container to drive the Visio ActiveX control and don't need Visio's VBA. However, you cannot insert other ActiveX controls in the Visio ActiveX control, because Visio uses VBA extensively when controls are inserted in a Visio drawing.
  183.  
  184. At this time Visio 5.0 does not support Property Pages, and does not provide a user interface (UI) to edit the properties of the ActiveX control. To change the properties of the control, you need to use Automation to change properties programmatically. Property Page support is planned for a future release.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.